package com.ipncinf.camera;

public class CommUtils {

	/**
	 * 判断是否有效字符串
	 */
	public static boolean isValidStr(String str) {
		return str != null && !"".equals(str);
	}

	/**
	 * 判断是否为正确数字
	 */
	public static boolean isCorrectNumber(String srcDateStr) {
		if (isValidStr(srcDateStr)) {
			try {
				Double.parseDouble(srcDateStr);
			} catch (NumberFormatException e) {
				return false;
			}
			return true;
		}
		return false;
	}

	/**
	 * 判断是否为正确数字
	 */
	public static boolean isCorrectInt(String srcDateStr) {
		if (isValidStr(srcDateStr)) {
			try {
				Integer.parseInt(srcDateStr);
			} catch (NumberFormatException e) {
				return false;
			}
			return true;
		}
		return false;
	}

	/**
	 * 删除最后一个字符
	 */
	public static String deleteLastChar(String srcDateStr) {
		if (isValidStr(srcDateStr)) {
			srcDateStr = srcDateStr.substring(0, srcDateStr.length() - 1);
		}
		return srcDateStr;
	}

	public static void main(String[] args) {
	}

}
